export default {
  mounted(el, binding) {
    const { value } = binding;
    el.addEventListener('click', () => {
      window.$modal.confirm({
        title: value.title || '提示',
        content: value.content || '确认执行该操作吗？',
        okText: value.okText || '确认',
        cancelText: value.cancelText || '取消',
        centered: value.centered || false,
        class: value.class || '',
        closable: value.closable || false,
        mask: value.mask || true,
        maskClosable: value.maskClosable || false,
        okType: value.okType || 'primary',
        wrapClassName: value.wrapClassName || '',
        zIndex: value.zIndex || 1000,
        onOk: () => {
          value?.onOk?.();
        },
        onCancel: () => {
          value?.onCancel?.();
        }
      });
    });
  },
  unMounted(el) {
    el.removeEventListener('click');
  }
};
